package com.sqx.modules.reward.controller;


import com.sqx.common.utils.Result;
import com.sqx.modules.reward.entity.Reward;
import com.sqx.modules.reward.service.RewardService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 奖励制度
 * </p>
 *
 * @author wuchang
 * @since 2023-01-16
 */
@RestController
@RequestMapping("/admin/reward/")
public class AdminRewardController {
    @Autowired
    private RewardService rewardService;


    @ApiOperation("添加或修改奖励制度")
    @PostMapping("saveReward")
    public Result saveReward(Reward reward) {
        return rewardService.saveReward(reward);
    }
    @ApiOperation("获取奖励制度列表")
    @GetMapping("getRewardList")
    public Result getRewardList(Integer page,Integer limit,Reward reward){
        return Result.success().put("data", rewardService.getRewardList(page,limit,reward));
    }
    @ApiOperation("删除")
    @PostMapping("deleteReward")
    public Result deleteReward(Long rewardId){
        return rewardService.removeById(rewardId) ? Result.success():Result.error();
    }
}

